Door = {}

function Door:new (number, status)
   local door = {}
   door.number = number
   door.status = status
   self.__index = self
   return setmetatable(door, self)
end

function Door:open_door ()
   self.status = "opened"
end

function Door:close_door ()
   self.status = "closed"
end

door = Door:new(10010, "opened")
print("door's number is: " .. door.number)
print("door's status is: " .. door.status)

print("现在关门做点坏事")
door.close_door(door)
print("door's status is: " .. door.status)

print("坏事做完，开启门窗透透气吧")
door:open_door()
print("door's status is: " .. door.status)
